<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>引导页</title>
    <link rel="stylesheet" type="text/css" href="css/api.css"/>
</head>
<body>

</body>
<script type="text/javascript" src="script/api.js"></script>
<script type="text/javascript" src="script/jquery.min.js"></script>
<script type="text/javascript" src="script/MD5.js"></script>
<script type="text/javascript" src="script/requestTool.js"></script>
<!-- <script type="text/javascript" src="script/push.js"></script> -->
<script type="text/javascript" src="script/setupWebOpenApp.js"></script>

<script type="text/javascript">
    apiready = function () {
        //设置网页打开应用
        setupWebOpenApp();
        var one = $api.getStorage('cfnetone');
        initDir();
        if (one != "" && one != null && one != undefined) {
            jumpToNextPage();
            return;
        }
        setguidepage();
        api.setFullScreen({
            fullScreen: true
        });
    };

    function initDir() {
        //创建缓存文件夹
        var fs = api.require('fs');
        fs.createDir({
            path: 'fs://cache/audio'
        }, function (ret, err) {
        });
    }

    function setguidepage() {
        $api.setStorage('cfnetone', "1");
        api.openFrameGroup({
            name: 'intro_pages',
            background: '#fff',
            scrollEnabled: true,
            rect: {
                x: 0,
                y: 0,
                w: 'auto',
                h: 'auto'
            },
            index: 0,
            frames: [{
                name: 'intro_1',
                url: 'html/GuidePage/guidepage1.html',
                bounces: false,
                opaque: true,
                bgColor: '#fff'
            }, {
                name: 'intro_2',
                url: 'html/GuidePage/guidepage2.html',
                bounces: false,
                opaque: true,
                bgColor: '#fff'
            }, {
                name: 'intro_3',
                url: 'html/GuidePage/guidepage3.html',
                bounces: false,
                opaque: true,
                bgColor: '#fff'
            }, {
                name: 'intro_4',
                url: 'html/GuidePage/guidepage4.html',
                bounces: false,
                opaque: true,
                bgColor: '#fff'
            }]
        }, function (ret, err) {
            var name = ret.name;
            var index = ret.index;
            if (index == 3) {
                setTimeout(function () {
                    openlogin();
                }, 3000);
            }
        });
    }

    function jumpToNextPage() {
        var recordPassword = $api.getStorage('cfnetpppassword');
        if (recordPassword == "" || recordPassword == null || recordPassword == undefined) {
            openlogin();
        } else {
            api.openWin({useWKWebView:true,
                name: 'index',
                url: 'index.html',
                slidBackEnabled: false,
                animation: {
                    type: "none"//动画类型
                }
                // ,
                // hScrollBarEnabled: false,
                // vScrollBarEnabled: false
            });
        }
    }

    //登录页
    function openlogin() {
        api.openWin({useWKWebView:true,
            name: 'login',
            url: 'login.html',
            animation: {
                type: "none", //动画类型（详见动画类型常量）
                subType: "from_right", //动画子类型（详见动画子类型常量）
                duration: 0
            },
            slidBackEnabled: false
        });
    }
</script>
</html>